package com.mengyu.moeisland.utils

import android.view.View
import android.widget.ImageView
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.Target.SIZE_ORIGINAL
import com.mengyu.moeisland.R

fun ImageLoad(fragment:Fragment,any: Any?,view:ImageView){
    Glide.with(fragment).load(any).into(view)
}

fun Fragment.imageLoad(any: Any?,view:ImageView){
    Glide.with(this).load(any).into(view)
}

fun FragmentActivity.imageLoad(any: Any?,view:ImageView){
    Glide.with(this).load(any).into(view)
}

fun ImageView.imageLoad(any: Any?){
    Glide.with(this).load(any) .error(R.drawable.ic_launcher_background).override(SIZE_ORIGINAL, SIZE_ORIGINAL).into(this)
}

fun ImageView.imageLoadPl(any: Any?){
    Glide.with(this).load(any).placeholder(R.drawable.ic_launcher_background).error(R.drawable.ic_launcher_background) .override(SIZE_ORIGINAL, SIZE_ORIGINAL).into(this)
}
